package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

class zaeb {
   private Workbook a = null;
   private Worksheet b = null;
   private int c;
   private HtmlSaveOptions d = null;
   private zaeh e = null;
   private String f;

   zaeb(zaeh var1, int var2, String var3, HtmlSaveOptions var4) {
      this.d = var4;
      this.e = var1;
      this.c = var2;
      this.a = var1.g;
      if (var2 != -1) {
         this.b = (Worksheet)var1.r.get(var2);
      } else {
         this.b = (Worksheet)var1.r.get(0);
      }

      this.a(var4);
      this.f = var3;
   }

   private void a(HtmlSaveOptions var1) {
      Cells var2;
      int var3;
      if (var1 != null && var1.getHiddenColDisplayType() == 1) {
         var2 = this.b.getCells();

         for(var3 = 0; var3 < var2.getColumns().getCount(); ++var3) {
            if (var2.getColumns().get(var3).isHidden()) {
               var2.deleteColumn(var3);
               --var3;
            }
         }
      }

      if (var1 != null && var1.getHiddenRowDisplayType() == 1) {
         var2 = this.b.getCells();

         for(var3 = 0; var3 < var2.getRows().getCount(); ++var3) {
            if (var2.getRows().get(var3).isHidden()) {
               var2.deleteRow(var3);
               --var3;
            }
         }
      }

   }

   String a(zafg var1, String var2, String var3, String var4, String var5, HtmlSaveOptions var6) throws Exception {
      this.d = var6;
      this.f = var3;
      this.a.l();
      if (this.c == -1) {
         return null;
      } else {
         String var7 = "sheet" + zaff.a(this.c + 1, 3) + ".htm";
         StreamProviderOptions var8 = new StreamProviderOptions();
         zafg var9 = this.e.a(var7, var1, var2, var3, var4, var5, var8);
         if (this.d.getExportDataOptions() == 255) {
            var9.a("<!doctype html public \"-//w3c//dtd xhtml 1.0 transitional//en\" \"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd\">");
            var9.g();
            var9.a(true, this.b.getDisplayRightToLeft());
            var9.g();
            var9.d();
            var9.a(false);
            this.e(var9);
            this.f(var9);
            var9.b("<!--[if gte mso 9]><xml>");
            this.c(var9);
            this.a(var9);
            var9.b("</xml><![endif]-->");
            var9.e();
            var9.g();
         }

         this.b(var9, var2, var3, var4, var5, var6);
         if (this.d.getExportDataOptions() == 255) {
            var9.g();
            var9.c();
            var9.g();
         }

         var9.h();
         this.e.u.closeStream(var8);
         return var7;
      }
   }

   String a(CellArea var1) {
      StringBuilder var2 = new StringBuilder();
      var2.append(CellsHelper.columnIndexToName(var1.StartColumn)).append(zase.y(var1.StartRow + 1));
      if (var1.StartColumn != var1.EndColumn || var1.StartRow != var1.EndRow) {
         var2.append(":").append(CellsHelper.columnIndexToName(var1.EndColumn)).append(zase.y(var1.EndRow + 1));
      }

      return com.aspose.cells.b.a.zr.a(var2);
   }

   String a(ArrayList var1, int var2, int var3) {
      StringBuilder var4 = new StringBuilder();

      for(int var5 = var2; var5 < var3; ++var5) {
         if (var5 > var2) {
            var4.append(",");
         }

         CellArea var6 = (CellArea)var1.get(var5);
         var4.append(this.a(var6));
      }

      return com.aspose.cells.b.a.zr.a(var4);
   }

   void a(zafg var1) throws Exception {
      ConditionalFormattingCollection var2 = this.b.getConditionalFormattings();

      for(int var3 = 0; var3 < var2.getCount(); ++var3) {
         FormatConditionCollection var4 = var2.get(var3);
         if (var4.getCount() == 0) {
            return;
         }

         var1.b("   <x:ConditionalFormatting>");
         if (var4.b != null && var4.b.size() > 0) {
            String var5 = this.a(var4.b, 0, var4.b.size());
            var1.b("    <x:Range>" + var5 + "</x:Range>");
         }

         for(int var9 = 0; var9 < var4.getCount(); ++var9) {
            FormatCondition var6 = var4.get(var9);
            var1.b("    <x:Condition>");
            String var7;
            if (var6.getType() == 0 && var6.b != 6) {
               var7 = zaff.b(var6);
               if (var7 != null) {
                  var1.b("     <x:Qualifier>" + var7 + "</x:Qualifier>");
               }
            }

            var1.b("     <x:Value1>" + zaff.h(var6.getFormula1()) + "</x:Value1>");
            if (var6.b == 0 || var6.b == 7) {
               var1.b("     <x:Value2>" + zaff.h(var6.getFormula2()) + "</x:Value2>");
            }

            var7 = zaff.a(var6);
            String var8 = "Style='" + var7 + "'/>";
            var1.b("     <x:Format " + var8);
            var1.b("    </x:Condition>");
         }

         var1.b("   </x:ConditionalFormatting>");
      }

   }

   void b(zafg var1, String var2, String var3, String var4, String var5, HtmlSaveOptions var6) throws Exception {
      boolean var7 = this.b.t() != null && this.b.t().getCount() > 0;
      Cells var8 = this.b.getCells();

      try {
         var8.d = new zkt(var8, 16383);
         var8.c = new zkw(var8, 16383);
         if (var7) {
            var8.getRows().b(2);
         }

         if (this.d.getExportDataOptions() == 255) {
            Column var9 = this.b.getCells().getColumns().a();
            StringBuilder var10 = new StringBuilder(100);
            var10.append("<body link=blue vlink=purple ");
            if (this.b.getBackgroundImage() != null) {
               StreamProviderOptions var11 = new StreamProviderOptions();
               boolean var12 = false;
               ShapeCollection var13 = this.b.t();
               int var22;
               if (var13 != null) {
                  var22 = var13.getCount() + 1;
               } else {
                  var22 = 1;
               }

               String var14 = "image00" + this.b.getIndex() + "_" + zase.y(var22) + "." + zaem.a(var6.getImageOptions().getImageFormat());
               var11.a = this.e.o + "/" + var14;
               this.e.u.initStream(var11);
               com.aspose.cells.b.a.b.zj var15 = com.aspose.cells.b.a.b.zj.a((com.aspose.cells.b.a.d.zm)(new com.aspose.cells.b.a.d.zh(this.b.getBackgroundImage())));
               if (var15.e().equals(ImageFormat.getBmp())) {
                  com.aspose.cells.b.a.b.za var16 = new com.aspose.cells.b.a.b.za(var15);
                  var16.a(var11.c, ImageFormat.getPng());
               } else {
                  var15.a(var11.c, ImageFormat.getPng());
               }

               this.e.u.closeStream(var11);
               if (this.e.r.size() == 1) {
                  var14 = var11.b == null ? var11.getDefaultPath() : var11.b;
               }

               var10.append("background=").append(var14).append(" ");
            }

            int var21 = var9.c();
            if (var21 != 15 && var21 != -1) {
               var10.append("class=x").append(zase.y(var21)).append(">");
               var1.b(com.aspose.cells.b.a.zr.a(var10));
            } else {
               var10.append(">");
               var1.b(com.aspose.cells.b.a.zr.a(var10));
            }

            var1.g();
            if (this.e.h != null && this.e.l != null) {
               String var23 = "<h1 style='color:black;font-family:Arial;font-size:14.0pt;font-weight:800;font-style:normal'>" + this.e.l + "</h1>";
               var1.b(var23);
            }
         }

         if (this.b.getType() == 1) {
            zadz var20 = new zadz(this.e, this.b, var1, var2, this.f, var4, var5, var6);
            var20.a(this.f);
            var20.a();
         } else if (this.b.getType() == 2 && this.e.n != null) {
            if (var6.getSaveFormat() != 17) {
               this.d(var1);
            } else {
               this.a(var1, var6);
            }
         }

         var1.g();
         if (this.e.a.get(this.b.m()) != null) {
            this.a(var1, (HashMap)this.e.a.get(this.b.m()));
         }

         this.a(var1, (ArrayList)this.e.b.get(this.b.m()), (HashMap)this.e.c.get(this.b.m()), (HashMap)this.e.d.get(this.b.m()));
         this.b(var1, (ArrayList)this.e.f.get(this.b.m()), (HashMap)this.e.e.get(this.b.m()), (HashMap)this.e.d.get(this.b.m()));
         if (this.d.getExportDataOptions() == 255) {
            var1.b("</body>");
         }
      } finally {
         var8.m();
         var8.l();
         if (var7) {
            var8.getRows().b();
         }

      }

      var1.g();
   }

   private void a(zafg var1, HashMap var2) throws Exception {
      if (var2.size() > 0) {
         var1.b("<script language = 'javascript' type='text/javascript'>");
         var1.b(" var ie = !-[1,];");
         var1.b(" function ChangeIEBase64()");
         var1.b(" {");
         var1.b("  var img;");
         var1.b("  if (ie)");
         var1.b("  {");
         Set var3 = var2.keySet();
         Iterator var4 = var3.iterator();

         while(var4.hasNext()) {
            String var5 = (String)((String)var4.next());
            var1.b("   img=document.getElementById(\"" + var5 + "\");");
            var1.b("   img.src=\"data:image/png;base64," + (String)var2.get(var5) + "\";");
         }

         var1.b("  }");
         var1.b(" }");
         var1.b(" ChangeIEBase64();");
         var1.b("</script>");
      }
   }

   private void a(zafg var1, ArrayList var2, HashMap var3, HashMap var4) throws Exception {
      if (var2 != null && var2.size() > 0 || var3 != null && var3.size() > 0) {
         var1.b("<script language = 'javascript' type='text/javascript'>");
         var1.b(" function ChangeColspanHiddenData()");
         var1.b(" {");
         var1.b("   var node;");
         String var5 = null;
         StringBuilder var6;
         if (var2 != null) {
            var6 = new StringBuilder("var params=[");

            for(int var7 = 0; var7 < var2.size(); ++var7) {
               var5 = (String)var2.get(var7);
               if (var4 != null && var4.get(var5) != null) {
                  var6.append("\"" + (String)var4.get(var5) + "\",");
               } else {
                  var6.append("\"" + var5 + "\",");
               }
            }

            String var12 = com.aspose.cells.b.a.zr.a(var6);
            var1.b("   " + var12.substring(0, 0 + (var12.length() - 1)) + "];");
            var1.b("   for (var i = 0;i < params.length; i++)");
            var1.b("   {");
            var1.b("       node = document.getElementById(params[i]);");
            var1.b("       if (node != null)");
            var1.b("       {");
            var1.b("           node.style.display = \"none\";");
            var1.b("       }");
            var1.b("   }");
         }

         if (var3 != null) {
            var6 = new StringBuilder("var ids=[");
            StringBuilder var13 = new StringBuilder("var spans=[");
            Set var8 = var3.keySet();
            Iterator var9 = var8.iterator();

            while(var9.hasNext()) {
               var5 = (String)((String)var9.next());
               var6.append("\"" + var5 + "\",");
               var13.append("\"" + (Integer)var3.get(var5) + "\",");
            }

            String var10 = com.aspose.cells.b.a.zr.a(var6);
            var1.b("   " + var10.substring(0, 0 + (var10.length() - 1)) + "];");
            String var11 = com.aspose.cells.b.a.zr.a(var13);
            var1.b("   " + var11.substring(0, 0 + (var11.length() - 1)) + "];");
            var1.b("   for (var i = 0;i < ids.length; i++)");
            var1.b("   {");
            var1.b("       node=document.getElementById(ids[i]);");
            var1.b("       if (node != null)");
            var1.b("       {");
            var1.b("           node.colSpan=spans[i];");
            var1.b("       }");
            var1.b("   }");
         }

         var1.b(" }");
         var1.b(" ChangeColspanHiddenData();");
         var1.b("</script>");
      }
   }

   private void b(zafg var1, ArrayList var2, HashMap var3, HashMap var4) throws Exception {
      if (var2 != null && var2.size() > 0 || var3 != null && var3.size() > 0) {
         var1.b("<script language = 'javascript' type='text/javascript'>");
         var1.b(" function ChangeRowspanHiddenData()");
         var1.b(" {");
         var1.b("   var node;");
         String var5 = null;
         StringBuilder var6;
         if (var2 != null) {
            var6 = new StringBuilder("var params=[");

            for(int var7 = 0; var7 < var2.size(); ++var7) {
               var5 = (String)var2.get(var7);
               if (var4 != null && var4.get(var5) != null) {
                  var6.append("\"" + (String)var4.get(var5) + "\",");
               } else {
                  var6.append("\"" + var5 + "\",");
               }
            }

            String var12 = com.aspose.cells.b.a.zr.a(var6);
            var1.b("   " + var12.substring(0, 0 + (var12.length() - 1)) + "];");
            var1.b("   for (var i = 0;i < params.length; i++)");
            var1.b("   {");
            var1.b("       node = document.getElementById(params[i]);");
            var1.b("       if (node != null)");
            var1.b("       {");
            var1.b("           node.style.display = \"\";");
            var1.b("       }");
            var1.b("   }");
         }

         if (var3 != null) {
            var6 = new StringBuilder("var ids=[");
            StringBuilder var13 = new StringBuilder("var spans=[");
            Set var8 = var3.keySet();
            Iterator var9 = var8.iterator();

            while(var9.hasNext()) {
               var5 = (String)((String)var9.next());
               var6.append("\"" + var5 + "\",");
               var13.append("\"" + (Integer)var3.get(var5) + "\",");
            }

            String var10 = com.aspose.cells.b.a.zr.a(var6);
            var1.b("   " + var10.substring(0, 0 + (var10.length() - 1)) + "];");
            String var11 = com.aspose.cells.b.a.zr.a(var13);
            var1.b("   " + var11.substring(0, 0 + (var11.length() - 1)) + "];");
            var1.b("   for (var i = 0;i < ids.length; i++)");
            var1.b("   {");
            var1.b("       node=document.getElementById(ids[i]);");
            var1.b("       if (node != null)");
            var1.b("       {");
            var1.b("           node.rowSpan=spans[i];");
            var1.b("       }");
            var1.b("   }");
         }

         var1.b(" }");
         var1.b(" ChangeRowspanHiddenData();");
         var1.b("</script>");
      }
   }

   private void a(zafg var1, HtmlSaveOptions var2) throws Exception {
      if (this.b.getCharts().getCount() != 0) {
         Chart var3 = this.b.getCharts().get(0);
         if (var3 != null) {
            com.aspose.cells.b.a.b.za var4;
            try {
               boolean var5 = false;
               if (var3.getChartArea().getArea().getFormatting() == 1) {
                  var3.getChartArea().getArea().setFormatting(2);
                  var3.getChartArea().getArea().setForegroundColor(Color.getWhite());
                  var5 = true;
               }

               var4 = var3.z();
               if (var5) {
                  var3.getChartArea().getArea().setFormatting(1);
               }

               if (var4 == null) {
                  return;
               }
            } catch (Exception var9) {
               return;
            }

            String var10 = "Chart" + this.b.getName() + "." + zaem.a(var2.getImageOptions().getImageFormat());
            var10 = zaff.d(var10);
            if (this.e.b()) {
               if (this.e.t != null) {
                  var10 = this.e.t + var10;
               } else {
                  var10 = this.e.n + var10;
               }
            } else if (!this.e.a()) {
               var10 = this.e.o + com.aspose.cells.b.a.d.zk.a + var10;
            }

            var10 = this.f + var10;
            String var6 = "<img src=\"" + var10 + "\" alt=1>";
            var1.b(var6);
            com.aspose.cells.b.a.d.zh var7 = new com.aspose.cells.b.a.d.zh();
            var4.a(var7, var2.getImageOptions().getImageFormat());
            byte[] var8 = var7.o();
            var1.b().put(var10, var8);
         }
      }
   }

   private void d(zafg var1) throws Exception {
      if (this.b.getCharts().getCount() != 0) {
         Chart var2 = this.b.getCharts().get(0);
         if (var2 != null) {
            com.aspose.cells.b.a.b.za var3;
            try {
               boolean var4 = false;
               if (var2.getChartArea().getArea().getFormatting() == 1) {
                  var2.getChartArea().getArea().setFormatting(2);
                  var2.getChartArea().getArea().setForegroundColor(Color.getWhite());
                  var4 = true;
               }

               var3 = var2.z();
               if (var4) {
                  var2.getChartArea().getArea().setFormatting(1);
               }

               if (var3 == null) {
                  return;
               }
            } catch (Exception var7) {
               return;
            }

            String var8 = "Chart" + this.b.getName() + ".jpg";
            var8 = zaff.d(var8);
            String var5 = this.e.n + var8;
            com.aspose.cells.b.a.d.zc.b(this.e.n);
            var3.a(var5, ImageFormat.getJpeg());
            if (this.e.b()) {
               if (this.e.t != null) {
                  var8 = this.e.t + var8;
               } else {
                  var8 = this.e.n + var8;
               }
            } else if (!this.e.a()) {
               var8 = this.e.o + com.aspose.cells.b.a.d.zk.a + var8;
            }

            String var6 = "<img src=\"" + var8 + "\" alt=1>";
            var1.b(var6);
         }
      }
   }

   private void e(zafg var1) throws Exception {
      var1.b("<link id=Main-File rel=Main-File href=\"../" + this.e.j + "\">");
      String var2 = (String)this.e.v.get("filelist.xml");
      if (var2 != null && this.e.c().isFullPathLink()) {
         var1.b("<link rel=File-List href=" + var2 + ">");
      } else {
         var1.b("<link rel=File-List href=filelist.xml>");
      }

      var1.b("<link rel=Edit-Time-Data href=editdata.mso>");
   }

   private void f(zafg var1) throws Exception {
      var1.b("<!--[if !mso]>");
      var1.b("<style>");
      var1.b("v\\\\:* {behavior:url(#default#VML);}");
      var1.b("o\\\\:* {behavior:url(#default#VML);}");
      var1.b("x\\\\:* {behavior:url(#default#VML);}");
      var1.b(".shape {behavior:url(#default#VML);}");
      var1.b("</style>");
      var1.b("<![endif]-->");
      String var2 = "sheet" + zaff.a(this.c + 1, 3) + ".htm";
      String var3 = (String)this.e.v.get(var2);
      if (var3 != null && this.e.c().isFullPathLink()) {
         String var4 = var3.substring(0, 0 + var3.indexOf(var2)) + "stylesheet.css";
         var1.b("<link rel=Stylesheet href=" + var4 + ">");
      } else {
         var1.b("<link rel=Stylesheet href=stylesheet.css>");
      }

      var1.b("<style>");
      var1.b("<!--table");
      var1.b(" {mso-displayed-decimal-separator:\"\\.\";");
      var1.b(" mso-displayed-thousand-separator:\"\\,\";}");
      this.b(var1);
      var1.b("-->");
      var1.b("</style>");
      var1.b("<![if !supportTabStrip]><script language=\"JavaScript\">");
      var1.b("<!--");
      var1.b("function fnUpdateTabs()");
      var1.b(" {");
      var1.b("  if (parent.window.g_iIEVer>=4) {");
      var1.b("   if (parent.document.readyState==\"complete\"");
      var1.b("    && parent.frames['frTabs'].document.readyState==\"complete\")");
      var1.b("   parent.fnSetActiveSheet(" + zase.y(this.c) + ");");
      var1.b("  else");
      var1.b("   window.setTimeout(\"fnUpdateTabs();\",150);");
      var1.b(" }");
      var1.b("}");
      var1.b("");
      var1.b("if (window.name!=\"frSheet\")");
      var1.b(" window.location.replace(\"../" + this.e.j + "\");");
      var1.b("else");
      var1.b(" fnUpdateTabs();");
      var1.b("//-->");
      var1.b("</script>");
      var1.b("<![endif]>");
   }

   private String a(String var1) {
      return null != var1 ? com.aspose.cells.b.a.zv.a(var1, "\"", "\\0022") : "";
   }

   void b(zafg var1) throws Exception {
      PageSetup var2 = this.b.getPageSetup();
      var1.b("@page");
      var1.b(" {");
      String var3 = "\"" + this.a(var2.a(true, 1)) + "\"";
      String var4 = "\"" + this.a(var2.a(false, 1)) + "\"";
      var3 = var3.trim();
      var4 = var4.trim();
      if (var3.length() > 0) {
         var1.b(" mso-header-data:" + var3 + ";");
      }

      if (var4.length() > 0) {
         var1.b(" mso-footer-data:" + var4 + ";");
      }

      String var5 = zase.b(var2.getTopMarginInch()) + "in " + zase.b(var2.getRightMarginInch()) + "in " + zase.b(var2.getBottomMarginInch()) + "in " + zase.b(var2.getLeftMarginInch()) + "in;";
      var1.b(" margin:" + var5);
      var1.b(" mso-header-margin:" + zase.b(var2.getHeaderMarginInch()) + "in;");
      var1.b(" mso-footer-margin:" + zase.b(var2.getFooterMarginInch()) + "in;");
      if (!var2.isAutoFirstPageNumber()) {
         var1.b(" mso-page-numbers-start:" + zase.y(var2.getFirstPageNumber()) + ";");
      }

      String var6 = var2.getOrientation() == 0 ? "Landscape" : "Portrait";
      var1.b(" mso-page-orientation:" + var6 + ";");
      if (var2.getCenterHorizontally()) {
         var1.b(" mso-horizontal-page-align:center;");
      }

      if (var2.getCenterVertically()) {
         var1.b(" mso-vertical-page-align:center;");
      }

      var1.b(" }");
   }

   void c(zafg var1) throws Exception {
      long var2 = zaff.d(this.b.getCells().getStandardWidthPixels());
      var1.b("<x:WorksheetOptions>");
      var1.b(" <x:StandardWidth>" + var2 + "</x:StandardWidth>");
      if (!this.b.getPageSetup().isPercentScale()) {
         var1.b(" <x:FitToPage/>");
      }

      this.i(var1);
      this.j(var1);
      if (this.b.isSelected()) {
         var1.b(" <x:Selected/>");
      }

      if (!this.b.isVisible()) {
         var1.b(" <x:Visible>SheetHidden</x:Visible>");
      }

      if (!this.b.isGridlinesVisible()) {
         var1.b(" <x:DoNotDisplayGridlines/>");
      }

      if (!this.b.isRowColumnHeadersVisible()) {
         var1.b(" <x:DoNotDisplayHeadings/>");
      }

      if (this.b.getFirstVisibleColumn() != 0) {
         var1.b(" <x:LeftColumnVisible>" + zase.y(this.b.getFirstVisibleColumn()) + "</x:LeftColumnVisible>");
      }

      if (this.b.getFirstVisibleRow() != 0) {
         var1.b(" <x:TopRowVisible>" + zase.y(this.b.getFirstVisibleRow()) + "</x:TopRowVisible>");
      }

      this.h(var1);
      if (this.b.a() != null) {
         this.g(var1);
      }

      var1.b("</x:WorksheetOptions>");
   }

   private void g(zafg var1) throws Exception {
      Protection var2 = this.b.a();
      if (!var2.getAllowEditingContent()) {
         var1.b(" <x:ProtectContents>True</x:ProtectContents>");
      } else {
         var1.b(" <x:ProtectContents>False</x:ProtectContents>");
      }

      if (!var2.getAllowEditingObject()) {
         var1.b(" <x:ProtectObjects>True</x:ProtectObjects>");
      } else {
         var1.b(" <x:ProtectObjects>False</x:ProtectObjects>");
      }

      if (!var2.getAllowEditingScenario()) {
         var1.b(" <x:ProtectScenarios>True</x:ProtectScenarios>");
      } else {
         var1.b(" <x:ProtectScenarios>False</x:ProtectScenarios>");
      }

      if (!var2.getAllowSelectingLockedCell() || !var2.getAllowSelectingUnlockedCell()) {
         if (!var2.getAllowSelectingLockedCell() && !var2.getAllowSelectingUnlockedCell()) {
            var1.b(" <x:EnableSelection>NoSelection</x:EnableSelection>");
         } else {
            var1.b(" <x:EnableSelection>UnlockedCells</x:EnableSelection>");
         }
      }

      if (var2.getAllowFormattingCell()) {
         var1.b(" <x:AllowFormatCells/>");
      }

      if (var2.getAllowFormattingColumn()) {
         var1.b(" <x:AllowSizeCols/>");
      }

      if (var2.getAllowFormattingRow()) {
         var1.b(" <x:AllowSizeRows/>");
      }

      if (var2.getAllowInsertingColumn()) {
         var1.b(" <x:AllowInsertCols/>");
      }

      if (var2.getAllowInsertingRow()) {
         var1.b(" <x:AllowInsertRows/>");
      }

      if (var2.getAllowInsertingHyperlink()) {
         var1.b(" <x:AllowInsertHyperlinks/>");
      }

      if (var2.getAllowDeletingColumn()) {
         var1.b(" <x:AllowDeleteCols/>");
      }

      if (var2.getAllowDeletingRow()) {
         var1.b(" <x:AllowDeleteRows/>");
      }

      if (var2.getAllowSorting()) {
         var1.b(" <x:AllowSort/>");
      }

      if (var2.getAllowFiltering()) {
         var1.b(" <x:AllowFilter/>");
      }

      if (var2.getAllowUsingPivotTable()) {
         var1.b(" <x:AllowUsePivotTables/>");
      }

   }

   private void h(zafg var1) {
   }

   private void i(zafg var1) throws Exception {
      var1.b(" <x:Print>");
      PageSetup var2 = this.b.getPageSetup();
      if (var2.getFitToPagesWide() != 1) {
         var1.b("  <x:FitWidth>" + zase.y(var2.getFitToPagesWide()) + "</x:FitWidth>");
      }

      if (var2.getFitToPagesTall() != 1) {
         var1.b("  <x:FitHeight>" + zase.y(var2.getFitToPagesTall()) + "</x:FitHeight>");
      }

      if (var2.getOrder() == 1) {
         var1.b("  <x:LeftToRight/>");
      }

      if (var2.getBlackAndWhite()) {
         var1.b("  <x:BlackAndWhite/>");
      }

      if (var2.getPrintDraft()) {
         var1.b("  <x:DraftQuality/>");
      }

      var1.b("  <x:ValidPrinterInfo/>");
      var1.b("  <x:PaperSizeIndex>" + zase.y(var2.getPaperSize()) + "</x:PaperSizeIndex>");
      if (var2.getZoom() != 100) {
         var1.b("  <x:Scale>" + zase.y(var2.getZoom()) + "</x:Scale>");
      }

      var1.b("  <x:HorizontalResolution>" + zase.y(var2.getPrintQuality()) + "</x:HorizontalResolution>");
      var1.b("  <x:VerticalResolution>" + zase.y(var2.getPrintQuality()) + "</x:VerticalResolution>");
      if (var2.getPrintHeadings()) {
         var1.b("  <x:RowColHeadings/>");
      }

      if (var2.getPrintComments() == 2) {
         var1.b("  <x:CommentsLayout>SheetEnd</x:CommentsLayout>");
      } else if (var2.getPrintComments() == 0) {
         var1.b("  <x:CommentsLayout>InPlace</x:CommentsLayout>");
      }

      if (var2.getPrintErrors() == 3) {
         var1.b("  <x:PrintErrors>NA</x:PrintErrors>");
      } else if (var2.getPrintErrors() == 1) {
         var1.b("  <x:PrintErrors>Dash</x:PrintErrors>");
      } else if (var2.getPrintErrors() == 0) {
         var1.b("  <x:PrintErrors>Blank</x:PrintErrors>");
      }

      if (var2.getPrintGridlines()) {
         var1.b("  <x:Gridlines/>");
      }

      this.a(var1, var2, true);
      this.a(var1, var2, false);
      var1.b(" </x:Print>");
   }

   private void a(zafg var1, PageSetup var2, boolean var3) throws Exception {
      Picture var4 = null;
      StreamProviderOptions var5 = null;
      String var6 = "";
      Object var7 = null;

      for(int var8 = 0; var8 < 3; ++var8) {
         var4 = var2.getPicture(var3, var8);
         byte[] var9 = null != var4 ? var4.getData() : null;
         if (null != var9 && this.d.getSaveFormat() != 17) {
            var6 = "image00" + this.b.getIndex() + "_" + zase.y(var4.x()) + var4.getName() + "." + zaem.a(var4.getImageFormat());
            var5 = new StreamProviderOptions();
            var5.a = this.e.o + com.aspose.cells.b.a.d.zk.a + var6;
            this.e.u.initStream(var5);
            var5.c.b(var9, 0, var9.length);
            this.e.u.closeStream(var5);
            this.a(var1, var4, var8, var6, var3);
         }
      }

   }

   private void a(zafg var1, Picture var2, int var3, String var4, boolean var5) throws Exception {
      if (var5) {
         var1.b("  <x:HeaderPicture>");
      } else {
         var1.b("  <x:FooterPicture>");
      }

      var1.b("   <x:Location>" + this.a(var3) + "</x:Location>");
      if (this.b(var4)) {
         var1.b("   <x:Source>" + var4 + "</x:Source>");
      }

      if (this.a((double)var2.getHeight())) {
         var1.b("   <x:Height>" + var2.getHeight() + "</x:Height>");
      }

      if (this.a((double)var2.getWidth())) {
         var1.b("   <x:Width>" + var2.getWidth() + "</x:Width>");
      }

      if (var2.isLockAspectRatio()) {
         var1.b("   <x:LockAspectRatio/>");
      }

      if (this.a(var2.getFormatPicture().getBrightness())) {
         var1.b("   <x:Brightness>" + var2.getFormatPicture().getBrightness() + "</x:Brightness>");
      }

      if (this.a(var2.getFormatPicture().getContrast())) {
         var1.b("   <x:Contrast>" + var2.getFormatPicture().getContrast() + "</x:Contrast>");
      }

      if (var2.getFormatPicture().isGray() && !var2.getFormatPicture().isBiLevel()) {
         var1.b("   <x:ColorType>Grayscale</x:ColorType>");
      } else if (var2.getFormatPicture().isBiLevel() && var2.getFormatPicture().isGray()) {
         var1.b("   <x:ColorType>BlackAndWhite</x:ColorType>");
      } else if (!var2.getFormatPicture().isGray() && !var2.getFormatPicture().isBiLevel() && this.a(var2.getFormatPicture().getBrightness()) && this.a(var2.getFormatPicture().getContrast())) {
         var1.b("   <x:ColorType>Watermark</x:ColorType>");
      } else {
         var1.b("   <x:ColorType>Automatic</x:ColorType>");
      }

      if (this.a(var2.getFormatPicture().getBottomCrop())) {
         var1.b("   <x:CropBottom>" + var2.getFormatPicture().getBottomCrop() + "</x:CropBottom>");
      }

      if (this.a(var2.getFormatPicture().getLeftCrop())) {
         var1.b("   <x:CropLeft>" + var2.getFormatPicture().getLeftCrop() + "</x:CropLeft>");
      }

      if (this.a(var2.getFormatPicture().getTopCrop())) {
         var1.b("   <x:CropTop>" + var2.getFormatPicture().getTopCrop() + "</x:CropTop>");
      }

      if (this.a(var2.getFormatPicture().getRightCrop())) {
         var1.b("   <x:CropRight>" + var2.getFormatPicture().getRightCrop() + "</x:CropRight>");
      }

      if (var5) {
         var1.b("  </x:HeaderPicture>");
      } else {
         var1.b("  </x:FooterPicture>");
      }

   }

   private String a(int var1) {
      String var2 = "";
      switch(var1) {
      case 0:
         var2 = "Left";
         break;
      case 1:
         var2 = "Center";
         break;
      case 2:
         var2 = "Right";
      }

      return var2;
   }

   private boolean b(String var1) {
      return null != var1 && !var1.equals("");
   }

   private boolean a(double var1) {
      return var1 > 0.0D || var1 < 0.0D;
   }

   private void j(zafg var1) throws Exception {
      int var2 = this.b.getZoom();
      byte var3 = 60;
      if (this.b.isPageBreakPreview()) {
         var1.b(" <x:ShowPageBreakZoom/>");
      }

      if (var2 != 100) {
         var1.b(" <x:Zoom>" + zase.y(var2) + "</x:Zoom>");
      }

      if (var3 != 60) {
         var1.b(" <x:PageBreakZoom>" + zase.y(var3) + "</x:PageBreakZoom>");
      }

   }
}
